import * as Cesium from 'cesium/Cesium'


function VisibilityState() {
    this.states = new Cesium.ManagedArray,
        this.count = 0
}

VisibilityState.prototype.hidePrimitiveCollection = function (e) {
    for (var t = e.length, i = 0; i < t; ++i) {
        var r = e.get(i);
        r instanceof Cesium.PrimitiveCollection ? this.hidePrimitiveCollection(r) : (this.states.push(r.show),
        r instanceof Cesium.Cesium3DTileset || r instanceof Cesium.Model || (r.show = !1))
    }
}
    ,
    VisibilityState.prototype.restorePrimitiveCollection = function (e) {
        for (var t = e.length, i = 0; i < t; ++i) {
            var r = e.get(i);
            r instanceof Cesium.PrimitiveCollection ? this.restorePrimitiveCollection(r) : r.show = this.states.get(this.count++)
        }
    }
    ,
    VisibilityState.prototype.hide = function (e) {
        this.states.length = 0,
            this.hidePrimitiveCollection(e.primitives),
            this.hidePrimitiveCollection(e.groundPrimitives)
    }
    ,
    VisibilityState.prototype.restore = function (e) {
        this.count = 0,
            this.restorePrimitiveCollection(e.primitives),
            this.restorePrimitiveCollection(e.groundPrimitives)
    }
;
export default VisibilityState;